POV-Ray : Newsgroups : povray.binaries.images : improved exclusion test macro [30k] : improved exclusion test macro [30k] Server Time
1 Aug 2024 00:18:28 EDT (-0400)
  improved exclusion test macro [30k]  
From: [GDS|Entropy]
Date: 15 Feb 2009 08:28:46
Message: <4998188e@news.povray.org>
Hello,

I have improved my macro following suggestions given to me regarding the 
previous version.
Please find attached test images.

Here is the "internal test" version:

//      exclusionTest Macro by [GDS|Entropy] - Release - Internal Version
#macro exclusionTest(ctr,vectorArray,testObject)
 #local vectorA = min_extent(testObject);
 #local vectorB = max_extent(testObject);
 #local i=0;
 #while (i<ctr)
  #if (((vectorArray[i].x <= vectorB.x) & (vectorArray[i].x >= vectorA.x)) &
       ((vectorArray[i].y <= vectorB.y) & (vectorArray[i].y >= vectorA.y)) &
       ((vectorArray[i].z <= vectorB.z) & (vectorArray[i].z >= vectorA.z)))
   #if (inside(testObject,vectorArray[i]))
    callExternal(ctr,0,vectorArray[i])
   #end
  #end
 #set i=i+1;
 #end
#end
//------

#macro callExternal(ctr,option,valueToPass)
 //     your macros here
#end

This seems to work with spheres, torii, cubes, quartic cyl, etc...
I haven't tested it on more complicated objects.

The source file has a few different versions of that macro, including a 
"meta" version with more options and one with #debug text included for ease 
of comprehension.

ian


Post a reply to this message


Attachments:
Download 'VectorTest_1_inObj_inBox__Hollow.jpg' (9 KB) Download 'VectorTest_1_outObj_inBox__Hollow0.jpg' (12 KB)

Preview of image 'VectorTest_1_inObj_inBox__Hollow.jpg'
VectorTest_1_inObj_inBox__Hollow.jpg

Preview of image 'VectorTest_1_outObj_inBox__Hollow0.jpg'
VectorTest_1_outObj_inBox__Hollow0.jpg


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.